<template>
  <div id="app" class="layout-page">
    <!-- card start -->
    <div class="ui-card-box" v-for="(i, index) in list" :key="index">
      <!-- <img class="img" :src="i.iconSrc" alt="icon" /> -->
      <!-- <img class="img" src="../assets/elasticComputing.png" alt="" /> -->
      <i
        class="img"
        :style="`background:url(${i.iconSrc});background-size:100%;`"
      />
      <p>{{ i.label }}</p>
    </div>
    <!-- card end -->
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import IconImage from "@/assets/elasticComputing.png";

const list = ref([
  {
    label: "弹性计算",
    // iconSrc: "https://gd-hbimg.huaban.com/6a7e98cf6cc047ddff8b91a8acc9457e5ce1b79317f80-vCLL7L",
    iconSrc: IconImage,
  },
]);
</script>

<style scoped lang="scss">
html,
body {
  margin: 0px;
  height: 100%;
  width: 100%;
}
.layout-page {
  width: 100%;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  background: #001427;
  overflow: auto;
}

@keyframes move {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 -1280px;
    /* 动画帧-1  1340px-64 */
  }
}

@keyframes moveOut {
  0% {
    background-position: 0 -1280px;
  }
  100% {
    background-position: 0 0px;
    /* 动画帧-1  1340px-64 */
  }
}

.ui-card-box {
  display: inline-flex;
  flex-direction: column;
  width: 160px;
  height: 200px;
  align-items: center;
  justify-content: center;
  transition: 0.6s;
  background: #1f93ff;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid;
  margin: 8px;

  $PrimaryColor: #ff6a00;

  .img {
    width: 64px;
    height: 64px;
    // background-size: 100%;
    border: none;
    animation: moveOut 0.6s forwards steps(20, end);
  }
  p {
    font-size: 12px;
    color: #fff;
  }
  &:hover {
    color: $PrimaryColor;
    border: 1px solid $PrimaryColor;
    box-shadow: 0px 2px 12px 0px rgba(#ff6a00, 0.5);
    .img {
      animation: move 0.6s forwards steps(20, end);
    }
  }
}
</style>
